# 这是单行注释

"""
- 这是多行注释
- 这是多行注释
- 这是多行注释
"""

# P16/P17---变量+数据类型
i = 1
f = 1.23
flag = True
c = 4 + 3j
s = "字符串类型"
print(type(i + 1.2))
print(f)
print(flag)
print(c)
print(s)

# P18---数据类型转换
i2 = int("123")
f2 = float("1.23")
s2 = str(123)
print(type(f2))
print(type(i2))
print(type(s2))

# P20---运算符 加 减 乘 除 取整 取余 指数(2**4 -> 2x2x2x2)
print(2 + 2)
print(2 - 2)
print(2 * 2)
print(2 / 2)
print(9 // 2)
print(9 % 2)
print(2 ** 4)

# P23---字符串格式化1
name1 = 123
name2 = 6
name3 = 9.998
message1 = "你好：%s,%d,%.3f" % (name1, name2, name3)
print(message1)
# P25---字符串格式化2
message2 = f"你好你好：{name1},{name2},{name3}"
print(message2)
# P25---数据输入
# input_name = input("请输入：")
# print(input_name)

# P34---if语句
age = 10
if age > 30:
    print(">10")
elif age > 20:
    print(">20")
else:
    print("<20")

# P38---while循环语句
a = 1
while a <= 10:
    print(a,end='')
    if a == 7:
        break
    else:
        a += 2
print()

# P43---for循环语句
fruits = ['banana', 'apple',  'mango']
for fruit in fruits:
    print(fruit)

for i in range(5):
    print(i)
